-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test!: attempt to resolve flakes #2834
Conversation
{ | ||
name: "2 mebibyte blob", | ||
blob: mustNewBlob(2 * mebibyte), | ||
blob: newBlobWithSize(2 * mebibyte), | ||
want: blobtypes.ErrTotalBlobSizeTooLarge.ABCICode(), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the multiple test cases of this test are affecting each other. Since the first two test cases aren't expected to encounter an error and that happy path is covered in other tests, proposal to drop them from this test.
Warning Rate Limit Exceeded@rootulp has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 7 minutes and 34 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe changes across various test files and packages reflect a refactoring and stabilization effort. The modifications include renaming test functions for clarity, removing flakiness indicators from test names, updating test structures and methods to accommodate new testing patterns, and refining test cases to focus on specific behaviors. Additionally, there's an introduction of new utility functions and constants to streamline testing processes. The changes aim to improve the reliability and readability of the test suite, ensuring that tests are more deterministic and better aligned with the intended test scenarios. Changes
Assessment against linked issues
Please note that the assessment is based on the provided summaries and without access to the full context or the ability to review the actual code changes, the assessment may not fully reflect the state of the codebase. TipsChat with CodeRabbit Bot (
|
b/c it is redundant with TestSubmitPayForBlob
app/test/integration_test.go
Outdated
Kibibyte = 1024 | ||
Mebibyte = 1024 * Kibibyte | ||
) | ||
|
||
func TestIntegrationTestSuite(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passing
$ go test -count=2 . -run "TestIntegrationTestSuite"
ok github.com/celestiaorg/celestia-app/app/test 50.124s
func (s *MaxTotalBlobSizeSuite) TestSubmitPayForBlob_blobSizes() { | ||
// TestErrTotalBlobSizeTooLarge verifies that submitting a 2 MiB blob hits | ||
// ErrTotalBlobSizeTooLarge. | ||
func (s *MaxTotalBlobSizeSuite) TestErrTotalBlobSizeTooLarge() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems less flaky
$ go test -count=5 . -run "TestMaxTotalBlobSizeSuite"
ok github.com/celestiaorg/celestia-app/app/test 31.621s
@@ -60,8 +60,7 @@ func (s *SquareSizeIntegrationTest) SetupSuite() { | |||
|
|||
// TestSquareSizeUpperBound sets the app's params to specific sizes, then fills the | |||
// block with spam txs to measure that the desired max is getting hit | |||
// The "_Flaky" suffix indicates that the test may fail non-deterministically especially when executed in CI. | |||
func (s *SquareSizeIntegrationTest) TestSquareSizeUpperBound_Flaky() { | |||
func (s *SquareSizeIntegrationTest) TestSquareSizeUpperBound() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't get it to fail locally but we should explore making this test faster
$ go test -count=1 . -run "TestSquareSizeIntegrationTest"
ok github.com/celestiaorg/celestia-app/app/test 106.361s
@@ -182,7 +177,9 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob() { | |||
} | |||
} | |||
|
|||
// The "_Flaky" suffix indicates that the test may fail non-deterministically especially when executed in CI. | |||
func TestIntegrationTestSuite_Flaky(t *testing.T) { | |||
func TestIntegrationTestSuite(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't repro locally
$ go test ./... -count=3 -run "TestIntegrationTestSuite"
ok github.com/celestiaorg/celestia-app/x/blob/client/testutil 64.982s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could get this to go way faster if we refactored it to not use the cosmos-sdk's network code #829
https://stackoverflow.com/questions/74239074/context-todo-or-context-background-which-one-should-i-prefer context.Background() seems preferable for this test where the surrounding code is not going to be refactored to accept a parent context
@@ -182,7 +177,9 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob() { | |||
} | |||
} | |||
|
|||
// The "_Flaky" suffix indicates that the test may fail non-deterministically especially when executed in CI. | |||
func TestIntegrationTestSuite_Flaky(t *testing.T) { | |||
func TestIntegrationTestSuite(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could get this to go way faster if we refactored it to not use the cosmos-sdk's network code #829
Duplicative of `TestSubmitPayForBlob` in signer_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
return blobfactory.RandBlobTxsWithAccounts( | ||
s.ecfg, | ||
tmrand.NewRand(), | ||
s.cctx.Keyring, | ||
c.GRPCClient, | ||
950000, | ||
600*kibibyte, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] Curious to know why this change was needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change wasn't strictly needed. I thought it was misleading that the variable name stated 1Mb
when the generator created transactions that weren't 1Mb. Opted to change the variable name and the size of txs created.
@@ -80,47 +72,41 @@ func (s *IntegrationTestSuite) SetupSuite() { | |||
func (s *IntegrationTestSuite) TestMaxBlockSize() { | |||
t := s.T() | |||
|
|||
// tendermint's default tx size limit is 1Mb, so we get close to that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] Shouldn't this be revised instead of removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is no longer accurate b/c now this tx generator creates transactions that are ~600 KiB
3, | ||
false, | ||
s.accounts[20:40], | ||
) | ||
} | ||
|
||
// Generate 80 randomly sized txs (max size == 50 KB). Generate these |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] Are these comments removed intentionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
Generate these transactions using some of the same accounts as the previous generator to ensure that the sequence number is being utilized correctly in blob txs
was incorrect because this tx generator used accounts 40 - 120 which does not overlap with the previous tx generator (20 - 40). So I deleted the misleading comment.
@@ -89,58 +81,14 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob() { | |||
expectedCode: 0, | |||
respType: &sdk.TxResponse{}, | |||
}, | |||
{ | |||
name: "unsupported share version", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] Mind elaborating why these tests cases were needed to be removed? how did they contribute to the test flakiness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they didn't contribute to flakiness but they were removed b/c they don't strictly need to be included in this integration test. Instead these cases should be covered by unit tests
@@ -127,7 +123,7 @@ func (s *IntegrationTestSuite) Test_FillBlock_InvalidSquareSizeError() { | |||
|
|||
for _, tc := range tests { | |||
s.Run(tc.name, func() { | |||
_, actualErr := s.cctx.FillBlock(tc.squareSize, s.accounts, flags.BroadcastAsync) | |||
_, actualErr := s.cctx.FillBlock(tc.squareSize, s.accounts[2], flags.BroadcastAsync) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Optional] I suppose s.accounts
points to a single account, right? then perhaps we could get rid of the plural s
at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s.accounts
is still a slice with multiple accounts. This line just uses one of those accounts.
var params *coretypes.ResultConsensusParams | ||
// this query can be flaky with fast block times, so we repeat it multiple | ||
// times in attempt to decrease flakiness | ||
for i := 0; i < 40; i++ { | ||
params, err = s.cctx.Client.ConsensusParams(context.TODO(), nil) | ||
for i := 0; i < 100; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] Mind explaining why it has been increased to 100?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to decrease flakiness
@@ -19,7 +19,14 @@ import ( | |||
coretypes "github.com/tendermint/tendermint/rpc/core/types" | |||
) | |||
|
|||
const ( | |||
kibibyte = 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit]
kibibyte = 1024 | |
kibibyte = 1024 // bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really want to commit this suggestion but I'm going to skip it b/c accepting it will require re-approvals which takes too much time
kibibyte = 1024 | ||
mebibyte = 1024 * kibibyte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] For improved reusability and maintainability, all such unit converter constants could be consolidated into a single location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #2873
Attempt to close #2672.
This PR refactors some of the tests. It also removes the
_Flaky
suffix from other tests that I can't locally reproduce failures for. I plan on keeping the other "flake" issues open for now.